<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:calli="http://callimachusproject.org/rdf/2009/framework#">
<head>
    <title>New OpenID Manager</title>
    <link href="../../callimachus-for-web-developers#Callimachus_auth_options" target="_blank" title="Help" />
    <script type="text/javascript"> // <![CDATA[
    jQuery(function($){
        function parameter(name) {
            var regex = new RegExp("\\b"+name+"=([^&#]*)")
            var m = regex.exec(window.location.hash)
            return m ? decodeURIComponent(m[1].replace(/\+/g, ' ')) : null
        }
    	if (window.location.hash) {
            $('#label').val(parameter('label')).change();
	        $('#comment').val(parameter('comment')).change();
	        $('#endpoint').val(parameter('endpoint')).change();
            $('#realm').val(parameter('realm')).change();
	        var authButton = parameter('button');
	        if (authButton) {
	            var de = jQuery.Event('drop');
	            de.dataTransfer = {getData:function(){return authButton}};
	            $('#authButton').trigger(de);
	        }
        }
    }); // ]]>
    </script>
</head>
<body>
    <h1>New OpenID Manager</h1>
    <form role="form" id="form" method="POST" action="" enctype="application/rdf+xml" typeof="calli:OpenIDManager calli:AuthenticationManager"
            onsubmit="return calli.saveResourceAs(event,calli.slugify($('#label').val()))">
        <fieldset>
            <div class="form-group">
                <label for="label">Label</label>
                <div class="controls">
                    <input type="text" class="form-control" id="label" value="{rdfs:label}" required="required" />
                </div>
            </div>
            <div class="form-group">
                <label for="endpoint">OpenID endpoint URL</label>
                <div class="controls">
                    <input type="url" id="endpoint" value="{calli:openIdEndpointUrl}" required="required" />
                </div>
            </div>
            <div class="form-group">
                <label for="realm">OpenID realm pattern</label>
                <div class="controls">
                    <input type="text" class="form-control" id="realm" value="{calli:openIdRealm}" required="required" />
                </div>
            </div>
            <div class="form-group">
                <label for="comment">Comment</label>
                <div class="controls">
                    <textarea id="comment" class="form-control" required="required">{rdfs:comment}</textarea>
                </div>
            </div>
            <div id="authButton" dropzone="link s:text/uri-list" class="form-group" ondrop="return calli.insertResource(event)">
                <label>Authentication button <a href="../types/Image?create" title="Upload"
                        onclick="return calli.createResource(event)" class="glyphicon glyphicon-list-alt" /></label>
                <div rel="calli:authButton" class="controls">
                    <span resource="?img" typeof="foaf:Image" class="ui-state-highlight ui-corner-all">
                        <img src="{?img}" />
                    </span>
                </div>
            </div>
            <div class="form-group">
                <button type="submit" class="btn btn-default">Add</button>
            </div>
        </fieldset>
    </form>
</body>
</html>
